package smartq.app;
//package com.app.smart_q;
//
//import java.util.ArrayList;
//import android.app.Activity;
//import android.content.Context;
//import android.content.Intent;
//import android.graphics.Typeface;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.Button;
//import android.widget.EditText;
//import android.widget.TextView;
//import android.widget.Toast;
//
//import com.app.project_nfc.R;
//import com.app.smart_q.InfoDB;
//import com.app.smart_q.InfoEntry;
//
//public class addInfoActivity extends Activity {
//
//	private Context context;
//	private InfoDB db;
//	private ArrayList<InfoEntry> infos;
//	private EditText name;
//	private EditText phone;
//	private Button buttonInfoSave;
//	private Button buttonInfoAddCancle;
//	private TextView addinfoHeader;
//	private TextView addinfoPhone;
//	private TextView addinfoName;
//
//	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
////		setContentView(R.layout.adinfo_layout);
////
////		Typeface tf = Typeface.createFromAsset(getAssets(),
////				"fonts/supermarket.ttf");
////		name = (EditText) findViewById(R.id.editTextInfoName);
////		name.setTypeface(tf);
////		phone = (EditText) findViewById(R.id.editTextInfoTelephone);
////		phone.setTypeface(tf);
////		buttonInfoSave = (Button) findViewById(R.id.buttonInfoSave);
////		buttonInfoSave.setTypeface(tf);
////		buttonInfoAddCancle = (Button) findViewById(R.id.buttonInfoAddCancle);
////		buttonInfoAddCancle.setTypeface(tf);
////		addinfoHeader = (TextView) findViewById(R.id.adinfoHeader);
////		addinfoPhone = (TextView) findViewById(R.id.adinfoPhone);
////		addinfoName = (TextView) findViewById(R.id.adinfoName);
////		addinfoHeader.setTypeface(tf);
////		addinfoPhone.setTypeface(tf);
////		addinfoName.setTypeface(tf);
//
//		// Context
//		context = this;
//		db = new InfoDB(context);
//		infos = new ArrayList<InfoEntry>();
//
//		buttonInfoSave.setOnClickListener(new OnClickListener() {
//			@Override
//			public void onClick(View arg0) {
//				if (name.length() == 0 || phone.length() == 0) {
//					Toast.makeText(context,
//							"��سҡ�͡ �������Ѿ�� ��Ъ��ͼ����ҹ",
//							Toast.LENGTH_SHORT).show();
//				} else {
//					long recordID = db.insert(1, name.getText().toString(),
//							phone.getText().toString());
//					Toast.makeText(context,
//							"���������ż����� Application ���º����",
//							Toast.LENGTH_SHORT).show();
//					restartFirstActivity();
//					if (recordID != -1) {
//						showAllInfo();
//						addInfoActivity.this.finish();
//					}
//
//				}
//			}
//		});
//
//		buttonInfoAddCancle.setOnClickListener(new OnClickListener() {
//			@Override
//			public void onClick(View arg0) {
//				addInfoActivity.this.finish();
//			}
//		});
//	}
//
//	public void showAllInfo() {
//		infos = db.selectAll();
//		if (infos.size() == 0) {
//			Toast.makeText(context, "You Don't have any Info name",
//					Toast.LENGTH_SHORT).show();
//		} else {
//			for (int i = 0; i < infos.size(); i++) {
//				Log.i("Info",
//						infos.get(i).getName() + "'s info\n"
//								+ infos.get(i).getPhone());
//				Log.i("Info", "-------------------------------------------\n");
//			}
//		}
//	}
//
//	private void restartFirstActivity() {
//		Intent i = getBaseContext().getPackageManager()
//				.getLaunchIntentForPackage(getBaseContext().getPackageName());
//		i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
//				| Intent.FLAG_ACTIVITY_NEW_TASK);
//		startActivity(i);
//	}
//
//}